Understanding NOW(), CURDATE(), and SYSDATE() in MySQL
MySQL provides several date and time functions, and three commonly used ones are NOW(), CURDATE(), and SYSDATE(). Although they look similar, they return different values and behave differently in queries.
Returns the current date and time based on the server's time zone.
NOW() is evaluated once per statement.
All rows in a long-running query see the same timestamp.
Returns only the current date (YYYY-MM-DD).
No time component.
Useful for filtering rows by the current day.
Returns the current date and time, like NOW().
BUT unlike NOW(), SYSDATE() is evaluated in real time.
Each row can see different timestamps in long-running queries.
This can lead to inconsistent results in replication unless sysdate-is-now is enabled.
NOW() → Returns date & time; fixed per query.
CURDATE() → Returns only date; no time part.
SYSDATE() → Returns date & time; evaluated at execution time (can change row-to-row).
In summary: Use NOW() when you want a consistent timestamp across the query, CURDATE() for date-only operations, and SYSDATE() when you need the exact execution moment for each row.